#include <stdio.h>

int main(int argc, const char *argv[])
{
    FILE *sfp, *dfp;
    char s[40];
    if (argc != 3)
    {
        printf("input error,try agian\n");
        printf("usage:./a.out srcfile destfile\n");
        return -1;
    }

    if ((sfp = fopen(argv[1], "r")) == NULL)
    {
        perror("fopen src file error");
        return -1;
    }
    if ((dfp = fopen(argv[2], "w")) == NULL)
    {
        perror("fopen dest file error");
        return -1;
    }

    while(fgets(s,sizeof(s),sfp)!=NULL)
    {
        fputs(s,dfp);
    }

    fclose(sfp);
    fclose(dfp);

    return 0;
}